package com.esri.core.tasks.ags.geoprocessing;

import com.esri.core.internal.util.d;
import com.esri.core.io.EsriServiceException;
import com.github.mikephil.charting.utils.Utils;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class GPLinearUnit extends GPParameter {
    private static final long serialVersionUID = 1;
    private double distance;
    private String units;

    public double getDistance() {
        return this.distance;
    }

    public String getUnits() {
        return this.units;
    }

    public void setDistance(double d) {
        this.distance = d;
    }

    public void setUnits(String str) {
        this.units = str;
    }

    public GPLinearUnit(String str) {
        this.distance = Utils.DOUBLE_EPSILON;
        this.units = "";
        setParamName(str);
        this.dataType = "GPLinearUnit";
    }

    public GPLinearUnit() {
        this("");
    }

    @Override // com.esri.core.tasks.ags.geoprocessing.GPParameter
    public String generateValueParams() throws Exception {
        return d.a(this);
    }

    @Override // com.esri.core.tasks.ags.geoprocessing.GPParameter
    public void fromJson(JsonParser jsonParser) throws Exception {
        if (!d.c(jsonParser)) {
            throw new EsriServiceException("Unable to parse the Response for this GPLinearUnit.");
        }
        while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
            String currentName = jsonParser.getCurrentName();
            jsonParser.nextToken();
            if ("distance".equals(currentName)) {
                this.distance = jsonParser.getDoubleValue();
            } else if ("units".equals(currentName)) {
                this.units = jsonParser.getText();
            } else {
                jsonParser.skipChildren();
            }
        }
    }

    public int hashCode() {
        long doubleToLongBits = Double.doubleToLongBits(this.distance);
        int i = (((int) (doubleToLongBits ^ (doubleToLongBits >>> 32))) + 31) * 31;
        String str = this.units;
        return i + (str == null ? 0 : str.hashCode());
    }

    public boolean equals(Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj != null && getClass() == obj.getClass()) {
            GPLinearUnit gPLinearUnit = (GPLinearUnit) obj;
            if (Double.doubleToLongBits(this.distance) != Double.doubleToLongBits(gPLinearUnit.distance)) {
                return false;
            }
            String str = this.units;
            if (str == null) {
                if (gPLinearUnit.units != null) {
                    return false;
                }
            } else if (!str.equals(gPLinearUnit.units)) {
                return false;
            }
            return true;
        }
        return false;
    }

    public String toString() {
        return "GPLinearUnit [distance=" + this.distance + ", units=" + this.units + "]";
    }
}
